This invention relates to computer systems, and particularly to a computing system with transactional memory using millicode assists.
Current multiprocessor and multithreaded computing systems allow the performance of a single software application to be scaled to many times the possible performance of a single threaded application. Current software and hardware systems provide for the parallel processing of multiple threads of execution. Software applications can use existing thread libraries, such as the POSIX pthread library, to control the creation of multiple threads of parallel execution. The use of multiple threads works well for applications that operate on easily partitioned tasks and data. Course grain locks can be used to control access to the few shared data structures to prevent rare conflicts between the data updates of multiple threads.
Many software applications contain data structures that must be shared among multiple threads and have frequent concurrent inspections and updates of the shared data structures. These applications require additional modifications in order to obtain good scaling when using large numbers of threads. Applications which use multiple threads of execution that access shared data structures currently require the use of specialized data locking routines in order to produce a reliable outcome that is free from deadlocks and corrupted data. The majority of existing multithreaded applications in this category use fine grained software locks to achieve good performance and correct operation. Writing high performance multithreaded programs which use fine grained software locks is extremely difficult and requires expert programming skills. The lack of these skills in the software industry severely limits the production of multithreaded applications which require the use of shared data structures and therefore the usefulness of multithreaded and multiprocessor computing systems for certain application classes, including many forms of transaction processing.
Various “Transactional Memory” systems have been proposed and built to provide a simpler programming model for constructing multithreaded applications that need to control access to shared data structures. These systems allow software running on one thread of execution to optimistically assume that shared data structures can be updated without conflict with the accesses and updates of other threads of execution. The speculative updates to memory are kept “pending” until the transactional memory system confirms that no conflicts with storage accesses of other threads have occurred. The transactional memory system must be able to discard the pending speculative updates when conflicts between the storage accesses of multiple threads are detected. The existing transactional memory systems range from those that rely completely on new software constructs to those that rely on a mixture of hardware and software to obtain reasonable performance. Some existing systems have very high overhead in terms of the number of instructions executed in support of the required transactional memory behavior. Other existing systems have limitations associated with complex data cache structures that hold the “pending” updates to memory in caches. The cache based systems use many additional cache coherency states which causes a large increase in the design and simulation efforts for those systems.
Recently transactional memory systems have been proposed as illustrated by Microsoft's U.S. Patent Application Publication No. U.S.2007/0028056 which use software “enlistment records” associated with memory locations that have been accessed by transactions. The Microsoft system also uses a “version value” in the “enlistment record”. FIG. 3 of Pub. No. 2007/0028056 includes an operation “Locate enlistment record of memory location”. The text describing FIG. 3 gives the example of the enlistment record being part of a software object at the referenced memory address. From Pub. No. 2007/0028056 in paragraph 24, it will be seen that Timothy L. Harris, the Microsoft inventor, indicates that an enlistment record is created with the use of a “software transactional memory interface”. The Microsoft Pub. No. 2007/0028056 uses version numbers associated with each enlistment record and needs to deal with cases where the version number exceeds the maximum number supported by the enlistment record. In hindsight, after learning of the details of our invention, it will be recognized that these features of the recent developments in transaction memory systems are not needed and can be improved upon.
Earlier, and now long ago, as pointed out in the development of fast paced computing systems developments summarized by David A. Wood, University of Wisconsin, Transactional Memory Workshop, April 8, 2005, it was Chang and Mergen of IBM (described in 801 Storage: Architecture and Programming) who proposed using a lock bit associated with each segment of virtual memory. Their system provided an ability to detect concurrent accesses of storage locations by multiple threads but restricted the total number of concurrent threads that could operate on any single virtual memory segment when the transaction locking mechanism becomes active. Large virtual memory page tables which are required by Chang and Mergen to execute concurrent threads imposes a performance penalty on all threads of execution that use virtual memory, not just those that execute “transactions, so the Chang and Mergen suggestions became an anecdote in the prior art, as Woods said “No one seems to be looking at what they learned”. The current invention uses a “Transaction Table” that is distinct from the virtual memory page tables of the system.
Unknown to Woods, in the Chang and Mergen IBM Yorktown facility there have been ongoing laboratory developments relating to transactional memory systems, culminating with the most recent transactional memory system described by Xiaowei Shen U.S. patent application Ser. No. 11/156913, filed Jun. 20, 2005, and entitled “Architecture Support of Best-Effort Atomic Transactions for Multiprocessor Systems”.
Shen describes a transactional memory system which focuses on using “caches as buffers for data accessed by atomic transactions”. Xiaowei Shen forces the failure of a transaction when the system detects a “buffer overflow” and does not propose dealing with the case of speculative data being evicted from the cache. A buffer overflow will result if too many transactional loads or stores target the same cache congruence class. The percentage of transactions which overflow the cache and fail will be proportional to the number of loads and stores contained in a transaction. Long transactions will fail more often.
Other systems have been proposed which use a cache to implement a conflict detection scheme, and to capture speculative data which overflows the cache. We have found it desirable not to rely primarily on data cache states for conflict detection. The required specialized cache states cause an undesired increase in complexity and also makes it difficult to add the required detection and isolation mechanisms to existing multiprocessor cache coherency designs. Nevertheless there are numerous attempts to exploit the cache which have been tried, besides the Xaiowei Shen development, including, Moore et al who describe the use of a “before-image log” in their paper “LogTM: Log-based Transactional Memory”. Moore uses cache coherency states to implement a conflict detection scheme. Another such system, Ananian et al describe a transactional memory system which uses a single “unsorted linear array data structure” to capture speculative data which overflows data caches. They use an extra bit per cache set, the “O” bit to indicate if that set has “overflowed”, and another bit per cache entry, the “T” bit to indicate that the entry holds speculative data. The linear array data structure does provide the ability to support longer transactions but it does not provide the fast detection capability of the current invention. The linear array in Ananian needs to be searched for any cache access that targets the set that “overflowed”. This can be a long process for transactions which cause many overflows. Rajwar, Herlihy and Lai take a similar approach as Ananian in their paper “Virtualizing Transactional Memory”. Rajwar also uses a data cache as the primary mechanism to track the speculative state associated with transactions. Speculative data which is forced out of the caches is moved to the XADT overflow area in virtual memory. The detection of a possible conflict with an address that is part of the XADT requires a slow linear search of the XADT. Rajwar describes the use of filters to eliminate some of these searches but there are many cases where the searches will still need to be done.
In addition to the above summarized developments in the field, many software interfaces and instruction set modifications have been proposed for the support of transactional memory. The paper “Architectural Semantics for Practical Transactional Memory” (McDonald et al, Computer Systems Laboratory, Stanford University, 2006—this paper listed in our IDS is submitted herewith and is incorporated herein by reference) compares some of the proposals and provides references for many others and is incorporated herein by reference.